home *** CD-ROM | disk | FTP | other *** search
Wrap
// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* // * CustDetail.js JavaScript Development by Burgeonet.com * // * Development Started 12-10-2000 * // * This File should be linked to PrintFile.js in the controlling page * // * Functions with descriptions surrounded with "*=*=*=*" are tested * // * complete and bug free * // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* // ********************************************************************** // * ToDo: // * // * // * // * // * Progress: // * routine to create unique name for form and index. // * Routine to create the details cookie // * routine to create index // * routine to save the form with index name // * routine to display index // * routine to select saved form from the index // * // * // * // * // * // ********************************************************************** // ---====**** Begin code section for Customer Detail display ****====--- // ********************************************************************** // * Establish array variables. These must match the * // * Customer Detail Variables as per the CustDetail.htm page. * // * * // * Customer Number CustNumber * // * Account Number AccNumber * // * Mr/Mrs/Miss/Ms Salute * // * First name FirstName * // * Initials Initials * // * Last Name LastName * // * Company Name Comp Name * // * Address Address * // * Address2 Address2 * // * Post Code PoCode * // * Telephone CustTele * // * * // * 1 2 3 4 5 6 7 8 9 10 11 12 13 14 * // * Delimitor characters ñ ª º ½ ¼ ║ ╗ ┐ ╢ ▐ ° ^ ó * // * * // ********************************************************************** // ** global variables for the orderform.** var CustNumber = new Array(); var AccNumber = new Array(); var Salute = new Array(); var FirstName = new Array(); var Initials = new Array(); var LastName = new Array(); var CompName = new Array(); var Address = new Array(); var Address2 = new Array(); var PoCode = new Array(); var CustTele = new Array(); // ** global variables for the shopping cart.** var counterA var itemNum = new Array(); var itemDescr = new Array(); var itemCost = new Array(); var itemQty = new Array(); // ----====**** Global variables. ****====---- var formIndex = new Array(); var counter = 0 var counterA = 0 var cookData = "" var idxData = "" var formName = "form" var expdate2 = new Date(); // ----------------------------- End ---------------------------------- // ----====****Begin shared cookie functions****====---- // ********************************************************************** // * Global expdate variable for cookies * // * Cookie is set to expire in 1 year * // ********************************************************************** var expdate = new Date(); expdate.setTime (expdate.getTime() + (365 * 24 * 60 * 60 * 1000)) // ----------------------------- End ---------------------------------- // ********************************************************************** // * Read cookie data. * // ********************************************************************** function getCookieData(name) { var label = name + "=" var cStart = document.cookie.indexOf(label) if (cStart != -1) { // If the cookie does not exist skip the load var labelLen = label.length var cLen = document.cookie.length cStart += labelLen var tempstr = document.cookie.substring(cStart,cLen) var cEnd = tempstr.indexOf(";") if (cEnd == -1) { cEnd = document.cookie.length } return unescape(tempstr.substring(0,cEnd)) } return"" } // ----------------------------- End ---------------------------------- // ********************************************************************** // * Write cookie data. * // ********************************************************************** function setCookieData(name,value,expires) { counter ++ document.cookie = name + "=" + counter + "@" + value + "; expires=" + expires + "; Path=" + "/" } // ----------------------------- End ---------------------------------- // ********************************************************************** // * Kill cookie function. * // ********************************************************************** function killCookie(name) { if (getCookieData(name)) { document.cookie = name + "=" + "; expires = Thu, 01-Jan-70 00:00:01 GMT" + ";path = /" cookData = "" counter = 0 history.go(0) } } // ----------------------------- End ---------------------------------- // ----====**** End shared cookie functions ****====---- // ********************************************************************** // * Begin code section to update the cookie to * // * add items to the shopping cart cookie 'Scart'. * // ********************************************************************** // ********************************************************************** // * Extract current value of cookie when page loads * // * and store the values in the global variables. * // ********************************************************************** if (getCookieData(name)) { orderString = getCookieData(name) cLen = orderString.length countEnd = orderString.indexOf("@") pointer = countEnd + 1 counter = orderString.substring(0,countEnd) cookData = orderString.substring(pointer,cLen) } // ----------------------------- End ---------------------------------- // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* // * Function to add details to the Details Cookie. * // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* function addDetails() { counter = 0 detailInfo = '' + CustNumber + '~' + AccNumber + 'ª' + Salute + '¼' + FirstName + '║' + Initials + '╗' + LastName + '┐' + CompName + '╢' + Address + '▐' + Address2 + ' ' + PoCode + '°' + CustTele + '^' cookData = eval("detailInfo") setCookieData("Detail", cookData, expdate.toGMTString()) } // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*= End *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* // ----====**** End code section for updating the cookie. ****====---- // ********************************************************************** // * Builds an array of the items to load the form. * // ********************************************************************** function formDetail(Idx,Cus,Acn,Sal,Fir,Ini,Lnm,Com,Adda,Addb,Pcde,Ctel) { CustNumber[Idx] = Cus AccNumber[Idx] = Acn Salute[Idx] = Sal FirstName[Idx] = Fir Initials[Idx] = Ini LastName[Idx] = Lnm CompName[Idx] = Com Address[Idx] = Adda Address2[Idx] = Addb PoCode[Idx] = Pcde CustTele[Idx] = Ctel } // ----------------------------- End ---------------------------------- // ********************************************************************** // * Builds an array of the items to load into the form. * // ********************************************************************** function orderDetail(seq,num,descr,cost,Qty) { itemNum[seq] = num itemDescr[seq] = descr itemCost[seq] = cost itemQty[seq] = Qty } // ----------------------------- End ---------------------------------- // ********************************************************************** // * Function to parse the cookie and extract the ordered * // * items from the string. * // ********************************************************************** function itemsOrdered() { if (getCookieData("Scart")) { substr0 = getCookieData("Scart") cLen = substr0.length offset0 = substr0.indexOf("@") counter = substr0.substring(0,offset0) j = 0 for (i=1; i<=counter; i++) { offsetq = eval('offset' + j + ''); substrq = eval('substr' + j + ''); eval('ind' + i + ' = offsetq + 1'); eval('substr' + i + ' = substrq.substring(ind' + i + ',cLen)'); eval('offset' + i + ' = substr' + i + '.indexOf("^")'); eval('item' + i + ' = substr' + i + '.substring(0,offset' + i + ')'); eval('catInd' + i + ' = item' + i + '.indexOf("`")'); eval('itemCat' + i + ' = item' + i + '.substring(0,catInd' + i + ')'); eval('descrInd' + i + ' = item' + i + '.indexOf("~")'); eval('itemDes' + i + ' = item' + i + '.substring((catInd' + i + ' + 1),descrInd' + i + ')'); eval('priceInd' + i + ' = item' + i + '.indexOf("½")'); eval('itemPr' + i + ' = item' + i + '.substring((descrInd' + i + ' + 2),priceInd' + i + ')'); eval('itemQt' + i + ' = item' + i + '.substring((priceInd' + i + ' + 1),offset' + i + ')'); eval('orderDetail(i,itemCat' + i + ',itemDes' + i + ',itemPr' + i + ',itemQt' + i +')'); j++ } } } // ----------------------------- End ---------------------------------- // ********************************************************************** // * Function to parse the cookie and extract the form details * // * items from the string. This in turn triggers the * // * writeDetails() function to display the form. * // ********************************************************************** function DetailsStored() { //addDetail = '' AccNumber + '~' + AccNumber + 'ª' + Salute + '¼' + FirstName //+ '║' + Initials + '╗' + LastName + '┐' + CompName + '╢' + Address + '▐' + Address2 //+ ' ' + PoCode + '°' + CustTele if (getCookieData("Detail")) { substr0 = getCookieData("Detail") cLen = substr0.length offset0 = substr0.indexOf("@") counter = substr0.substring(0,offset0) counterA = counter //====used in form ====??? is it needed or can we just use counter j = 0 for (i=1; i<=counter; i++) { offsetq = eval('offset' + j + ''); substrq = eval('substr' + j + ''); eval('ind' + i + ' = offsetq + 1'); eval('substr' + i + ' = substrq.substring(ind' + i + ',cLen)'); eval('offset' + i + ' = substr' + i + '.indexOf("^")'); eval('item' + i + ' = substr' + i + '.substring(0,offset' + i + ')'); // Customer Number eval('CusInd' + i + ' = item' + i + '.indexOf("~")'); eval('Cus' + i + ' = item' + i + '.substring(0,CusInd' + i + ')'); // Account Number eval('AccInd' + i + ' = item' + i + '.indexOf("ª")'); eval('Acc' + i + ' = item' + i + '.substring((CusInd' + i + ' + 1),AccInd' + i + ')'); // Salutation eval('SalutInd' + i + ' = item' + i + '.indexOf("¼")'); eval('Salut' + i + ' = item' + i + '.substring((AccInd' + i + ' + 1),SalutInd' + i + ')'); // First Name eval('FirstInd' + i + ' = item' + i + '.indexOf("║")'); eval('FirstNam' + i + ' = item' + i + '.substring((SalutInd' + i + ' + 1),FirstInd' + i + ')'); // Initials eval('InitialInd' + i + ' = item' + i + '.indexOf("╗")'); eval('Initials' + i + ' = item' + i + '.substring((FirstInd' + i + ' + 1),InitialInd' + i + ')'); // Last Name eval('LastNamInd' + i + ' = item' + i + '.indexOf("┐")'); eval('LastNam' + i + ' = item' + i + '.substring((InitialInd' + i + ' + 1),LastNamInd' + i + ')'); // Company Name eval('CompNamInd' + i + ' = item' + i + '.indexOf("╢")'); eval('CompNam' + i + ' = item' + i + '.substring((LastNamInd' + i + ' + 1),CompNamInd' + i + ')'); // Address eval('AddInd' + i + ' = item' + i + '.indexOf("▐")'); eval('Add' + i + ' = item' + i + '.substring((CompNamInd' + i + ' + 1),AddInd' + i + ')'); // Address2 eval('Add2Ind' + i + ' = item' + i + '.indexOf(" ")'); eval('Add2' + i + ' = item' + i + '.substring((AddInd' + i + ' + 1),Add2Ind' + i + ')'); // Postal Code eval('PoCdeInd' + i + ' = item' + i + '.indexOf("°")'); eval('PoCde' + i + ' = item' + i + '.substring((Add2Ind' + i + ' + 1),PoCdeInd' + i + ')'); // Telephone eval('CustTel' + i + ' = item' + i + '.substring((PoCdeInd' + i + ' + 1),offset' + i + ')'); eval('formDetail(i,Cus' + i + ',Acc' + i + ',Salut' + i + ',FirstNam' + i + ',Initials' + i + ',LastNam' + i +',CompNam' + i + ',Add' + i +',Add2' + i +',PoCde' + i +',CustTel' + i +')'); j++ } } } function showForm() { WriteDetails(); } // ------------------------ End Cookie Reader ------------------ // ----====**** $$$ ****====---- // ----====**** End Customer Detail cookie code. ****====---- // ****Start of code section for calculations**** function update() { if (getCookieData("Scart")) { var sub_total = 0; for (i=1; i<itemNum.length; i++) eval('sub_total += parseFloat(itemCost[' + i + '] * itemQty[' + i + ']);'); //document.shopCart.subtotal.value= fix(sub_total); return + fix(sub_total); } } // ** Round to 2 decimal places** function fix(num) { string = "" + num; if (string.indexOf('.') == -1) return string + '.00'; seperation = string.length - string.indexOf('.'); if (seperation > 3) return string.substring(0,string.length-seperation+3); else if (seperation == 2) return string + '0'; return string; } // ** Add carriage charge if necessary ** function carriage(num) { if (num > 30) { return ""; } if (num < 30) { return 2.5; } } function grand() { if (getCookieData("Scart")) { var up = update(); var car = eval('carriage(up)'); var gt = eval('up + car'); return fix(gt); } } // ********************************************************************** // * Function to add customer details and order details to the * // * save form cookie * // * When the form index display is written create unique name * * // ********************************************************************** function saveform() { var thedate = new Date(); numdate = thedate.toLocaleString(); dataString = getCookieData("Scart") cLen = dataString.length countEnd = dataString.indexOf("@") pointer = countEnd + 1 counter = dataString.substring(0,countEnd) counterD = counter scartData = dataString.substring(pointer,cLen) dataString = getCookieData("Detail") cLen = dataString.length countEnd = dataString.indexOf("@") pointer = countEnd + 1 counter = dataString.substring(0,countEnd) cusData = dataString.substring(pointer,cLen) cookData = '' + cusData + 'ó' + counterD + '@' + scartData + '^' counter = 0 setCookieData(numdate,cookData,expdate.toGMTString()) //=========================================================== if (getCookieData("fIndex")) { dataString = getCookieData("fIndex") cLen = dataString.length countEnd = dataString.indexOf("@") pointer = countEnd + 1 counter = dataString.substring(0,countEnd) idxData = dataString.substring(pointer,cLen) idxData += eval("numdate + '^'"); setCookieData("fIndex", idxData, expdate.toGMTString()) //detailInfo = '' + Salute + '¼' + FirstName // + '║' + Initials + '╗' + LastName + '┐' + CompName + '╢' + Address // + '▐' + Address2 + ' ' + PoCode + '°' + CustTele + '^' } else { counter = 0 idxData = eval("numdate + '^'"); setCookieData("fIndex", idxData, expdate.toGMTString()) } history.go(0) } // ********************************************************************** // * Builds an array of the items to load into the form. * // ********************************************************************** function indexDetail(Idx,idxdetail) { formIndex[Idx] = idxdetail } // ----------------------------- End ---------------------------------- // ********************************************************************** // * Function to parse the cookie and extract the ordered * // * items from the string. * // ********************************************************************** function displayIndex() { if (getCookieData("fIndex")) { substr0 = getCookieData("fIndex") cLen = substr0.length offset0 = substr0.indexOf("@") counter = substr0.substring(0,offset0) j = 0 for (i=1; i<=counter; i++) { offsetq = eval('offset' + j + ''); substrq = eval('substr' + j + ''); eval('ind' + i + ' = offsetq + 1'); eval('substr' + i + ' = substrq.substring(ind' + i + ',cLen)'); eval('offset' + i + ' = substr' + i + '.indexOf("^")'); eval('item' + i + ' = substr' + i + '.substring(0,offset' + i + ')'); eval('indexDetail(i,item' + i + ')'); j++ } } } // ** Function to load the index Variables ** // ** before writing the index function showIndex() { displayIndex(); writeIndex(); } // ** Function to load the index Variables ** // ** before writing the index function showBasket() { itemsOrdered() ; writecheckout(); } // ** Function to write the shopping cart details ** // ** into the table on the shopping cart page. function writeIndex() { var ordFrm = ' <form name="shopCart">' ordFrm += ' <TABLE WIDTH="466" BGCOLOR="#000096" BORDER="1" BORDERCOLOR="#000096"' ordFrm += ' CELLPADDING="0" CELLSPACING="0"> ' ordFrm += ' <TR> ' ordFrm += ' <TD BGCOLOR="#FFFFFF"> ' ordFrm += ' <TABLE WIDTH="466" BGCOLOR="#000096" BORDER="0" CELLPADDING="0"' ordFrm += ' CELLSPACING="0"> ' ordFrm += ' <TR VALIGN="TOP"> ' ordFrm += ' <TD WIDTH="80" VALIGN="TOP" ALIGN="LEFT"><FONT' ordFrm += ' FACE="verdana,Arial,helvetica" SIZE="1" COLOR="#FFFFFF">' ordFrm += ' <B> Order<BR> Code</B></FONT></TD> ' ordFrm += ' <TD WIDTH="326" VALIGN="TOP" ALIGN="LEFT"><FONT' ordFrm += ' FACE="verdana,Arial,helvetica" SIZE="1"' ordFrm += ' COLOR="#FFFFFF"><B>Description</B></FONT></TD> ' ordFrm += ' <TD VALIGN="TOP" ALIGN="LEFT" WIDTH="60"><FONT' ordFrm += ' FACE="verdana,Arial,helvetica" SIZE="1"' ordFrm += ' COLOR="#FFFFFF"><B>Remove </B></FONT></TD> ' ordFrm += ' </TR> ' ordFrm += ' </TABLE> ' ordFrm += ' <TABLE WIDTH="466" BORDER="0" CELLPADDING="0"' ordFrm += ' CELLSPACING="0" BGCOLOR="#FBCE82"> ' ordFrm += ' <TR> ' ordFrm += ' <TD></TD> ' ordFrm += ' </TR> ' ordFrm += ' </TABLE> ' for (i = 1; i <= counter; i++) { ordFrm += ' <TABLE WIDTH="466" BGCOLOR="#FEF0D8" BORDER="0" CELLPADDING="0"' ordFrm += ' CELLSPACING="0"> ' ordFrm += ' <TR> ' ordFrm += ' <TD WIDTH="80"><FONT SIZE="1" FACE="Arial" COLOR="#FFFFCC"><A' ordFrm += ' HREF="javascript:extractOrder('+i+')"><IMG' ordFrm += ' SRC="showord.gif" WIDTH="75" HEIGHT="15" BORDER="0"></A></FONT></TD> ' ordFrm += ' <TD><FONT SIZE="1" FACE="Arial" COLOR="#000033">Order of ' + formIndex[i] + '</FONT></TD> ' ordFrm += ' <TD WIDTH="70" ALIGN="RIGHT"><FONT SIZE="1" FACE="Arial" COLOR="#FFFFCC"><A' ordFrm += ' HREF="javascript:clearIndex(' + i + ')"><IMG' ordFrm += ' SRC="remove.gif" WIDTH="60" HEIGHT="15" BORDER="0"></A> </FONT></TD> ' ordFrm += ' </TR> ' ordFrm += ' </TABLE> ' ordFrm += ' <TABLE WIDTH="466" BORDER="0" CELLPADDING="0"' ordFrm += ' CELLSPACING="0" BGCOLOR="#FBCE82"> ' ordFrm += ' <TR> ' ordFrm += ' <TD></TD> ' ordFrm += ' </TR> ' ordFrm += ' </TABLE> ' } ordFrm += ' <TABLE WIDTH="466" BORDER="0" CELLPADDING="0"' ordFrm += ' CELLSPACING="0" BGCOLOR="#FBCE82"> ' ordFrm += ' <TR> ' ordFrm += ' <TD></TD> ' ordFrm += ' </TR> ' ordFrm += ' </TABLE> ' ordFrm += ' <TABLE WIDTH="466" BGCOLOR="#FEF0D8" BORDER="0" CELLPADDING="0"' ordFrm += ' CELLSPACING="0"> ' ordFrm += ' <TR VALIGN="MIDDLE"> ' ordFrm += ' <TD ALIGN="CENTER" VALIGN="MIDDLE" WIDTH="100%"><A' ordFrm += ' HREF="javascript:history.go(-1)"><IMG SRC="return.gif" WIDTH="60" HEIGHT="15"' ordFrm += ' BORDER="0"></A></TD> ' ordFrm += ' </TR> ' ordFrm += ' </TABLE> </TD> ' ordFrm += ' </TR> ' ordFrm += ' </TABLE>' ordFrm += '</form> ' document.write(ordFrm); document.close(); } // ****End shopping cart detail section.**** // ****Start of code section to display subtotal.**** function update() { if (getCookieData("Scart")) { var sub_total = 0; for (i=1; i<itemNum.length; i++) eval('sub_total += parseFloat(itemCost[' + i + '] * itemQty[' + i + ']);'); //document.shopCart.subtotal.value= fix(sub_total); return + fix(sub_total); } } // ** Function to write the shopping cart details ** // ** into the table on the shopping cart page. function writecheckout() { var ordFrm = ' <BR> ' ordFrm += ' <FORM METHOD="post"' ordFrm += ' ACTION="https://catalogue.maplin.co.uk/direct/CDEntry.asp" ID="form1"' ordFrm += ' NAME="form1" Target="about:blank"> <INPUT TYPE="hidden" NAME="TotalItems" VALUE="' + counter + '"> ' ordFrm += ' <TABLE WIDTH="466" BGCOLOR="#000000" BORDER="1"BORDERCOLOR="#000096"' ordFrm += ' CELLPADDING="0" CELLSPACING="0"> ' ordFrm += ' <TR> ' ordFrm += ' <TD BGCOLOR="#FFFFFF"> ' ordFrm += ' <TABLE WIDTH="466" BGCOLOR="#000096" BORDER="0" CELLPADDING="0"' ordFrm += ' CELLSPACING="0"> ' ordFrm += ' <TR VALIGN="TOP"> ' ordFrm += ' <TD WIDTH="60" VALIGN="TOP" ALIGN="LEFT"><FONT' ordFrm += ' FACE="verdana,Arial,helvetica" SIZE="1" COLOR="#FFFFFF">' ordFrm += ' <B> Order<BR> Code</B></FONT></TD> ' ordFrm += ' <TD WIDTH="140" VALIGN="TOP" ALIGN="LEFT"><FONT' ordFrm += ' FACE="verdana,Arial,helvetica" SIZE="1"' ordFrm += ' COLOR="#FFFFFF"><B>Description</B></FONT></TD> ' ordFrm += ' <TD COLSPAN="2" WIDTH="60" VALIGN="TOP" ALIGN="CENTER"><FONT' ordFrm += ' COLOR="#FFFFFF" FACE="verdana,Arial,helvetica" SIZE="1"><B>Qty</B></FONT></TD> ' ordFrm += ' <TD WIDTH="70" VALIGN="TOP" ALIGN="RIGHT"><FONT' ordFrm += ' FACE="verdana,Arial,helvetica" SIZE="1" COLOR="#FFFFFF"><B>inc.VAT' ordFrm += ' <BR>each</B></FONT></TD> ' ordFrm += ' <TD WIDTH="60" ALIGN="RIGHT" VALIGN="TOP"><FONT' ordFrm += ' FACE="verdana,Arial,helvetica" SIZE="-2"' ordFrm += ' COLOR="#FFFFFF"><B>Total</B></FONT></TD> ' ordFrm += ' <TD VALIGN="TOP" ALIGN="CENTER" WIDTH="80"><FONT' ordFrm += ' FACE="verdana,Arial,helvetica" SIZE="1"' ordFrm += ' COLOR="#FFFFFF"><B>Remove</B></FONT></TD> ' ordFrm += ' </TR> ' ordFrm += ' </TABLE> ' ordFrm += ' <TABLE WIDTH="466" BORDER="0" CELLPADDING="0"' ordFrm += ' CELLSPACING="0" BGCOLOR="#FBCE82"> ' ordFrm += ' <TR> ' ordFrm += ' <TD></TD> ' ordFrm += ' </TR> ' ordFrm += ' </TABLE> ' for (i = 1; i <= counter; i++) { ordFrm += ' <TABLE WIDTH="466" BGCOLOR="#FEF0D8" BORDER="0" CELLPADDING="0"' ordFrm += ' CELLSPACING="0"> ' ordFrm += ' <TR> ' ordFrm += ' <TD WIDTH="60"><FONT FACE="verdana,Arial,helvetica" SIZE="-2"' ordFrm += ' COLOR="#330099"><B> ' + itemNum[i] + '</B></FONT></TD> ' ordFrm += ' <TD WIDTH="140"><FONT FACE="verdana,Arial,helvetica"' ordFrm += ' SIZE="-2">' + itemDescr[i] + '</FONT></TD> ' ordFrm += ' <TD WIDTH="45" ALIGN="CENTER"><FONT' ordFrm += ' FACE="verdana,Arial,helvetica" SIZE="1">' + itemQty[i] + '</FONT></TD> ' ordFrm += ' <TD WIDTH="70" ALIGN="RIGHT"><FONT FACE="verdana,Arial,helvetica"' ordFrm += ' SIZE="-2">£' + itemCost[i] + '</FONT></TD> ' ordFrm += ' <TD WIDTH="60" ALIGN="RIGHT"><FONT FACE="verdana,Arial,helvetica"' ordFrm += ' SIZE="-2">£' + fix(itemCost[i] * itemQty[i]) + '</FONT></TD> ' ordFrm += ' <TD WIDTH="80" ALIGN="RIGHT"><A href="javascript:clearIt('+i+')"><IMG' ordFrm += ' SRC="remove.gif" WIDTH="60" HEIGHT="15" BORDER="0"></A></TD> ' ordFrm += ' <!-- Hidden Text Boxes to store code and quantity for submission -->' ordFrm += ' <TR> ' ordFrm += ' <TD><INPUT TYPE="hidden" NAME="OrderCode' + i + '" MAXLENGTH="5" VALUE="' + itemNum[i] + '">' ordFrm += ' <INPUT TYPE="hidden" NAME="Quantity' + i + '" MAXLENGTH="5" VALUE="' + itemQty[i] + '"> </TD> ' ordFrm += ' </TR> ' ordFrm += ' <!-- =========================================================== -->' ordFrm += ' </TR> ' ordFrm += ' </TABLE> ' ordFrm += ' <TABLE WIDTH="466" BORDER="0" CELLPADDING="0"' ordFrm += ' CELLSPACING="0" BGCOLOR="#FBCE82"> ' ordFrm += ' <TR> ' ordFrm += ' <TD></TD> ' ordFrm += ' </TR> ' ordFrm += ' </TABLE> ' } ordFrm += ' <TABLE WIDTH="466" BGCOLOR="#FEF0D8" BORDER="0" CELLPADDING="0"' ordFrm += ' CELLSPACING="0"> ' ordFrm += ' <TR> ' ordFrm += ' <TD WIDTH="60"> </TD> ' ordFrm += ' <TD WIDTH="140"><FONT FACE="verdana,Arial,helvetica"' ordFrm += ' SIZE="-2" COLOR="#006400">Total Items = ' + counter + '</FONT></TD> ' ordFrm += ' <TD WIDTH="45" ALIGN="CENTER"> </TD> ' ordFrm += ' <TD WIDTH="70" ALIGN="RIGHT"><FONT FACE="verdana,Arial,helvetica"' ordFrm += ' SIZE="-2" COLOR="#000066">Sub Total</FONT></TD> ' ordFrm += ' <TD WIDTH="60" ALIGN="RIGHT"><FONT FACE="verdana,Arial,helvetica"' ordFrm += ' SIZE="-2">£' + update() + '</FONT></TD> ' ordFrm += ' <TD WIDTH="80" ALIGN="RIGHT"> </TD> ' ordFrm += ' </TR> ' ordFrm += ' </TABLE>' ordFrm += ' <TABLE WIDTH="466" BORDER="0" CELLPADDING="0"' ordFrm += ' CELLSPACING="0" BGCOLOR="#FBCE82"> ' ordFrm += ' <TR> ' ordFrm += ' <TD></TD> ' ordFrm += ' </TABLE> ' ordFrm += ' </TD> ' ordFrm += ' </TR> ' ordFrm += ' </TABLE>' ordFrm += '</form> ' document.write(ordFrm); document.close(); } function clearIt(num) { if (confirm("Remove Qty " + itemQty[i] + " Code " + itemNum[i] + ' Description ' + itemDescr[i] )) { itemsOrdered(); //Refresh Variables and load Variable "counter" itemNum[num] = "item" rewriteCookie(counter) } } // **Function to rewrite the cookie when the user ** // **deletes a line item from the shopping cart. ** function rewriteCookie(num) { dataUpdate = "" for (i=1; i<=counter; i++) { if (itemNum[i] != "item") { dataUpdate += itemNum[i] + '`' + itemDescr[i] + '~$' + itemCost[i] + '½' + itemQty[i] + '^' } } counter = counter - 2 cookData = dataUpdate expdate2.setTime (expdate.getTime() + (7 * 24 * 60 * 60 * 1000)) setCookieData("Scart", cookData, expdate2.toGMTString()) history.go(0) } // ** Function to delete an index item upon user request. ** // function clearIndex(num) { // alert("Clear " + num) // if (confirm("Remove order of " + num + ' ' + formIndex[num])) { // alert("Confirmed " + num) // formFile = formIndex[num] // alert("FormFile " + num) // killCookie(formFile) // alert("Killed " + num) // displayIndex() // alert("Display " + num) // // formIndex[num] = "item" // alert("Formindex " + num + " " + formIndex[num]) // rewriteIndex(num) // } //} // **Function to rewrite the cookie when the user ** // **deletes a line item from the index. ** //function rewriteIndex(num) { // Counter // alert("Rewrite " + num) // dataUpdate = "" // for (i=1; i<=counter; i++) { // if (formIndex[i] != "item") { // dataUpdate += formIndex[i] + '^' // } // } // counter = counter - 2 // cookData = dataUpdate // setCookieData("fIndex", cookData, expdate.toGMTString()) // alert("Cookie Set " + num) // history.go(0) //} //function clearIt(num) { // itemNum[num] = "item" // rewriteCookie(num) //} // **Function to rewrite the cookie when the user ** // **deletes a line item from the shopping cart. ** //function rewriteCookie(num) { // dataUpdate = "" // for (i=1; i<=counter; i++) { // if (itemNum[i] != "item") { // dataUpdate += itemNum[i] + '`' + itemDescr[i] + '~$' + itemCost[i] + '½' + itemQty[i] + '^' // } // } // counter = counter - 2 // cookData = dataUpdate // setCookieData("Scart", cookData, expdate.toGMTString()) // history.go(0) //} // ** Function to delete index & Form items upon user request. ** function clearIndex(num) { if (confirm("Remove order of " + num + ' ' + formIndex[num])) { formFile = formIndex[num] formIndex[num] = "item" displayIndex(); dataUpdate = "" for (i=1; i<=counter; i++) { if (i != num) { dataUpdate += formIndex[i] + '^' } } counter = counter - 2 cookData = dataUpdate setCookieData("fIndex", cookData, expdate.toGMTString()) killCookie(formFile) history.go(0) } }